#include <iostream>
#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;

int main() {
  Mat src = imread("../images/2.jpg");
  if (src.empty()) {
    cout << "could not load image.." << endl;
    return -1;
  }
  namedWindow("opencv setup demo", CV_WINDOW_AUTOSIZE);
  imshow("opencv setup demo", src);

  //　上采样
  Mat dst1;
  pyrUp(src, dst1, Size(src.cols * 2, src.rows * 2));
  imshow("pyrUp", dst1);

  // 将采样
  Mat dst2;
  pyrDown(src, dst2, Size(src.cols / 2, src.rows / 2));
  imshow("pyrDown", dst2);

  Mat gray_src, g1, g2, dot_img;
  cvtColor(src, gray_src, CV_BGR2GRAY);
  GaussianBlur(gray_src, g1, Size(3, 3), 0, 0);
  GaussianBlur(g1, g2, Size(3, 3), 0, 0);
  // 高斯不同DOG
  subtract(g1, g2, dot_img, Mat());
  // 归一化
  normalize(dot_img, dot_img, 255, 0, NORM_MINMAX);
  imshow("dot img", dot_img);

  waitKey(0);
  return 0;
}